home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000071_icon-group-sender _Wed Mar 31 09:26:05 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  5KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id JAA09302
  4.     for icon-group-addresses; Wed, 31 Mar 1999 09:25:57 -0700 (MST)
  5. Message-Id: <199903311625.JAA09302@baskerville.CS.Arizona.EDU>
  6. Date: Tue, 30 Mar 1999 17:28:55 -0600
  7. From: Steve Graham <graham@cowboy.biomed.com>
  8. X-Accept-Language: en
  9. To: Alan Saichek <abs@reba.engr.sgi.com>,
  10.         Icon Mailing List <icon-group@optima.CS.Arizona.EDU>
  11. Subject: Re: [Fwd: Problem reading binary file]
  12. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  13. Status: RO
  14.  
  15. Alan,
  16.  
  17.    I tried it and that did the trick.  Thanks a lot.
  18.  
  19.  
  20. Steve Graham
  21.  
  22. ===
  23.  
  24. Alan Saichek wrote:
  25. >         Hi Steve,
  26. >                 I haven't tried this, but on the surface...
  27. >                 Ctrl-Z is end-of-file in DOS.
  28. >         Check out Chap 11 Input and Output (2nd edition)
  29. >         Text Files and Binary Files
  30. >         which mentions translated mode. Use "u" qualifier for
  31. >         untranslated mode.
  32. > > >   in  := open(args[1],"ru") | stop("Unable to open ",args[1])
  33. > > >   out := open(args[2],"wu") | stop("Unable to open ",args[2])
  34. >         Regards, Alan
  35. > >
  36. > > Hello again.
  37. > >
  38. > > Turns out that the problem with this was that the 7th character was an
  39. > > ASCII 26 (^Z) and Icon would not read any further than that.  I created
  40. > > a 2nd file with a ^Z in a different position and got a similar result.
  41. > > This is despite the fact that there were over 25,000 characters
  42. > > following the Control Z.
  43. > >
  44. > > So, my question is:  Why does Icon stop reading when it hits a ^Z?  I
  45. > > can kind of understand this if I were reading a text file; but I was
  46. > > specifically using reads() because this is a binary file?  Should not
  47. > > reads() support all 256 ASCII codes and only stop reading when there are
  48. > > REALLY no more characters to read?  I ended up using another language,
  49. > > which was significantly harder for me, to read the binary characters.
  50. > >
  51. > > In Icon's defense, I notice that when I TYPE the above-mentioned 2nd
  52. > > file, I only see the characters occurring prior to the ^Z.  And I do not
  53. > > want it to appear that I am questioning Icon's usefulness.  It is
  54. > > normally one of the 1st languages I choose for utilities of this type.
  55. > >
  56. > > Comments?
  57. > >
  58. > >
  59. > > Steve Graham
  60. > >
  61. > > ===
  62. > >
  63. > > Steve Graham wrote:
  64. > > >
  65. > > > Hello.
  66. > > >
  67. > > > I am using MS-DOS Icon 9.1 to read a binary file.  After reading 6
  68. > > > characters, the program apparently quits reading.  I have attached the
  69. > > > relevant portion of the code:
  70. > > >
  71. > > > -------------------------- Code ------------------------------
  72. > > > procedure main(args)
  73. > > > #
  74. > > >   cnt := 0
  75. > > >   in  := open(args[1],"r") | stop("Unable to open ",args[1])
  76. > > >   out := open(args[2],"w") | stop("Unable to open ",args[2])
  77. > > >   while character := reads(in,1) do {
  78. > > >      write(character," -->", ord(character))
  79. > > >      cnt := cnt+1
  80. > > >     }
  81. > > >   close(in,out)
  82. > > >   write(cnt," characters transferred")
  83. > > > end
  84. > > > -----------------------End of Code-------------------------
  85. > > >
  86. > > > I invoke the program with:
  87. > > >
  88. > > > word r99-0059.doc r99-0059.txt
  89. > > >
  90. > > > I get output of (some unprintable characters are represent by _):
  91. > > >
  92. > > > - -->208
  93. > > > - -->207
  94. > > >  -->17
  95. > > > _ -->224
  96. > > > ∩┐╜ -->161
  97. > > > _ -->177
  98. > > > 6 characters transferred
  99. > > >
  100. > > > Any ideas?
  101. > > >
  102. > > > Thanks in advance.
  103. > > >
  104. > > > -- Steve
  105. > > >
  106. > > > ______________________________________________________
  107. > > >
  108. > > > Steve Graham
  109. > > > Laboratory Corporation of America (LabCorp)
  110. > > > 12160 Abrams Road, Suite 601
  111. > > > Dallas, Texas 75243
  112. > > >
  113. > > > E-mail: graham@cowboy.biomed.com
  114. > > > Phone:  972.643.6124  (direct to desk)
  115. > > >         972.437.5255 ext 5224
  116. > > > FAX:    972.454.1040
  117. > > > _______________________________________________________
  118. > >
  119. > --
  120. > Alan B. Saichek                                         abs@engr.sgi.com
  121. > Member Technical Staff - QA Team Lead                   (650) 933-2507
  122. > Advanced Entertainment Systems, Video Compute R&D       07L-808
  123.  
  124. -- 
  125.  
  126.  
  127. ______________________________________________________
  128.  
  129. Steve Graham
  130. Laboratory Corporation of America (LabCorp)                
  131. 12160 Abrams Road, Suite 601
  132. Dallas, Texas 75243
  133.  
  134. E-mail: graham@cowboy.biomed.com
  135. Phone:  972.643.6124  (direct to desk)
  136.         972.437.5255 ext 5224
  137. FAX:    972.454.1040
  138. _______________________________________________________
  139.